package com.gxuwz.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.gxuwz.dao.impl.TopicDao;
import com.gxuwz.pojo.Topic;
import com.gxuwz.pojo.Topic;
import com.gxuwz.service.ITopicService;

@Service("topicService")
public class TopicServiceImpl implements ITopicService {

	@Autowired
	private TopicDao topicDao;
	

	@Override
	public List<Topic> list(Topic entity) {
		// TODO Auto-generated method stub
		return topicDao.findByEntity(entity);
	}

	@Override
	public Topic save(Topic entity) {
		// TODO Auto-generated method stub
		return topicDao.save(entity);
	}

	@Override
	public void remove(Topic entity) {
		// TODO Auto-generated method stub
		topicDao.remove(entity);
	}

	@Override
	public void update(Topic entity) {
		// TODO Auto-generated method stub
		topicDao.update(entity);
	}

	@Override
	public List<Topic> findByHql(String queryString, Object[] params) {
		// TODO Auto-generated method stub
		return topicDao.findByHql(queryString, params);
	}

	@Override
	public List<Topic> findByExample(Object exampleEntity) {
		// TODO Auto-generated method stub
		return topicDao.findByExample(exampleEntity);
	}

	@Override
	public List<Topic> findByEntity(Topic entity) {
		// TODO Auto-generated method stub
		return topicDao.findByEntity(entity);
	}

	@Override
	public Topic findById(Integer id) {
		// TODO Auto-generated method stub
		return topicDao.find("from Topic where id="+id).get(0);
	}

	@Override
	public List<Topic> findByProperty(String property, String value) {
		// TODO Auto-generated method stub
		return topicDao.findByProperty(property, value);
	}

	@Override
	public void del(Integer id) {
		// TODO Auto-generated method stub
		Topic topic = findById(id);
		topic.setIsDelete(1);
		update(topic);
		
	}


}
